// 轮播图相关的SQL语句
module.exports = {
  // 获取活动的轮播图列表
  GET_ACTIVE_BANNERS: `
    SELECT 
      id,
      title,
      image_url,
      route_path,
      sort_order,
      description
    FROM banners
    WHERE status = 'active'
      AND (start_time IS NULL OR start_time <= NOW())
      AND (end_time IS NULL OR end_time >= NOW())
    ORDER BY sort_order ASC, id DESC
  `,

  // 获取所有轮播图（包括未启用的，用于管理后台）
  GET_ALL_BANNERS: `
    SELECT *
    FROM banners
    ORDER BY sort_order ASC, id DESC
  `,

  // 创建轮播图
  CREATE_BANNER: `
    INSERT INTO banners (
      title,
      image_url,
      route_path,
      sort_order,
      status,
      start_time,
      end_time,
      description
    ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)
  `,

  // 更新轮播图
  UPDATE_BANNER: `
    UPDATE banners
    SET 
      title = ?,
      image_url = ?,
      route_path = ?,
      sort_order = ?,
      status = ?,
      start_time = ?,
      end_time = ?,
      description = ?
    WHERE id = ?
  `,

  // 删除轮播图
  DELETE_BANNER: `
    DELETE FROM banners WHERE id = ?
  `,

  // 更新轮播图状态
  UPDATE_BANNER_STATUS: `
    UPDATE banners SET status = ? WHERE id = ?
  `
}; 